#coding:utf8
from rest_framework import serializers
from .models import Area

class AreaSerializer(serializers.ModelSerializer):
    """
    行政区划信息序列化器
    """
    class Meta:
        model = Area
        fields = ('id', 'name')






class AreaSerializer1(serializers.ModelSerializer):
    """
    行政区划信息序列化器
    """
    # area_set = [Area,Area,Area]
    # BookSerializer（books,many=True）
    # area_set = AreaSerializer(many=True,read_only=True)
    subs = AreaSerializer(many=True,read_only=True)
    class Meta:
        model = Area
        # fields = ('id', 'name','area_set')
        fields = ('id', 'name','subs')